package net.haiyue.api.service;

import net.haiyue.api.entity.Module;
import net.haiyue.api.entity.SelectInfo;
import net.haiyue.api.entity.User;
import net.haiyue.api.repository.ModuleRepository;
import net.haiyue.api.repository.UserRepository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Service
public class ModuleService {
    @Resource
    private ModuleRepository _repository;
    @Resource
    private UserRepository _userRepository;

    public List<Module> All() {
        return _repository.findAll();
    }
    public List<Module> findByProjectId(int id){
        return  _repository.findByProjectId(id);
    }

    public Module add(Module module){
        return _repository.saveAndFlush(module);
    }

    public List<SelectInfo>selectModule(int id){
        return _repository.selectModule(id);
    }

}
